<?php

namespace App\Models;

use Watson\Validating\ValidatingTrait;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class SendAwardWorks extends Model
{
    use SoftDeletes;
    use ValidatingTrait;

    protected $table='xyj_send_award_works';

    protected $fillable = ['name' , 'content'];

    protected $rules = [
        'name' => 'required|max:30',
        'content' => 'required|max:100',
    ];

    protected $validationMessages = [
        'name.required' => '名称必填',
        'name.max' => '名称不得超过30个字符',
        'content.required' => '发送内容必填',
        'content.max' => '发送内容不得超过100个字符',
    ];

    public function works()
    {
        return $this->belongsToMany('\App\Models\Works', 'xyj_send_works', 'send_id', 'works_id');
    }
}
